<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 分割数组 -->
    <script>
      var partitionDisjoint = function (nums) {
        let n = nums.length
        let leftM = nums[0]
        let leftP = 0
        let curM = nums[0]
        for (let i = 1; i < n - 1; i++) {
          curM = Math.max(curM, nums[i])
          if (nums[i] < leftM) {
            leftM = curM
            leftP = i
          }
        }
        return leftP + 1
      }
      console.log(partitionDisjoint([5, 0, 3, 8, 6]))
    </script>
  </body>
</html>
